home *** CD-ROM | disk | FTP | other *** search
/ Megahits 7 / Megahits 7 (1995)(GTI - Rhein-Main-Soft)(DE)[!].iso / franz / franz_101_150 / franz_130.dms / franz_130.adf / PLTTools / PLTDisplay / PLTDisplay.asm < prev    next >
Assembly Source File  |  1991-06-22  |  29KB  |  1,186 lines

  1.  
  2. ; ***********************************************************
  3. ; *                                                         *
  4. ; * P L A T I N U M - D I S P L A Y - R E P L A C E M E N T *
  5. ; *                                                         *
  6. ; *                        V 1.00                           *
  7. ; *                                                         *
  8. ; ***********************************************************
  9. ; *                                                         *
  10. ; *          Assembler-Source / Assembler: Devpac II        *
  11. ; *                                                         *
  12. ; *                    (C)April 1991 by                     *
  13. ; *                                                         *
  14. ; *                    Joerg Schliesser                     *
  15. ; *                  Platinum-Softwareline                  *
  16. ; *                   Rotenwaldstrasse 20                   *
  17. ; *                   D-7000 Stuttgart 1                    *
  18. ; *                         Germany                         *
  19. ; *                                                         *
  20. ; ***********************************************************
  21.  
  22. ; *** Amiga OS-Routinen ***
  23.  
  24.     ; Exec-Library
  25. AllocMem    =    -198
  26. FreeMem        =    -210
  27. FindTask    =    -294
  28. GetMsg        =    -372
  29. ReplyMsg    =    -378
  30. WaitPort    =    -384
  31. CloseLibrary    =    -414
  32. OpenLibrary    =    -552
  33.  
  34.     ; Dos-Library
  35. Open        =    -30
  36. Close        =    -36
  37. Read        =    -42
  38. Lock        =    -84
  39. UnLock        =    -90
  40. DupLock        =    -96
  41. Examine        =    -102
  42. CurrentDir    =    -126
  43. Delay        =    -198
  44.  
  45.     ; Intuition-Library
  46. ClearPointer    =    -60
  47. CloseScreen    =    -66
  48. CloseWindow    =    -72
  49. DrawImage    =    -114
  50. OpenScreen    =    -198
  51. OpenWindow    =    -204
  52. PrintIText    =    -216
  53. RefreshGadgets    =    -222
  54. SetPointer    =    -270
  55.  
  56.     ; Graphics-Library
  57. SetRast        =    -234
  58. SetRGB4        =    -288
  59. RectFill    =    -306
  60. SetAPen        =    -342
  61. InitBitMap    =    -390
  62. AllocRaster    =    -492
  63. FreeRaster    =    -498
  64. ScrollVPort    =    -588
  65.  
  66. ; assembler-options
  67.  
  68.     section    programm,code    ;1st section, code, public_mem
  69.  
  70. ; check WB- or CLI-start and get WB-startup-message
  71.  
  72. start:
  73.     move.l    sp,startsp    ;save stackpointer 
  74.     move.l    a0,memo1    ;cli textpointer
  75.     move.w    d0,memo2    ;cli textlength
  76.     move.l    4,a6
  77.     suba.l    a1,a1        ;get adress of pltdisplay-task
  78.     jsr    FindTask(a6)
  79.     move.l    d0,thistask
  80.  
  81.     lea    dosname,a1
  82.     moveq    #0,d0
  83.     jsr    OpenLibrary(a6)    ;open dos_lib
  84.     move.l    d0,dosbase
  85.     beq    quitpltdisplay
  86.  
  87.     lea    graphname,a1
  88.     moveq    #0,d0
  89.     jsr    OpenLibrary(a6)    ;open graph_lib
  90.     move.l    d0,graphbase
  91.     beq    quitpltdisplay
  92.  
  93.     lea    intuiname,a1
  94.     moveq    #0,d0
  95.     jsr    OpenLibrary(a6)    ;open intui_lib
  96.     move.l    d0,intuibase
  97.     beq    quitpltdisplay
  98.  
  99.     move.l    #1024,d0
  100.     move.l    #$10003,d1
  101.     jsr    AllocMem(a6)    ;get infomem (for fileinfoblock etc.)
  102.     move.l    d0,infomem
  103.     beq    quitpltdisplay
  104.  
  105.     move.l    thistask,a4    ;pointer to task-struct
  106.     tst.l    $ac(a4)        ;started from CLI ?
  107.     beq    wbstart
  108.  
  109. ; get filename if started from CLI
  110.  
  111.     move.l    memo1,a0    ;text-pointer
  112.     move.w    memo2,d0    ;text-length
  113.     subq.w  #1,d0        ;no text ?
  114.     beq    nofile        ;well then ... waiting
  115. lforname:
  116.     cmpi.b    #$20,(a0)+    ;look for 'space'
  117.     bne    foundname    ;no space ... got beginning of filename
  118.     dbra    d0,lforname
  119.     bra    nofile        ;no space ... no filename !
  120. foundname:
  121.     subq.l    #1,a0        ;got filename
  122. getfilename:
  123.     lea    filename,a1    ;adress of memory for filename
  124.     cmp.b    #34,(a0)    ;drop " - char at the beginning
  125.     beq    dropfirst
  126.     cmp.b    #39,(a0)    ;drop ' - char at the beginning
  127.     bne    copyname
  128. dropfirst:
  129.     adda.l    #1,a0
  130. copyname:            ;copy filename
  131.     move.b    (a0)+,d1
  132.     beq    eofname        ;zero => end
  133.     cmp.b    #10,d1
  134.     beq    eofname        ;linefeed => end
  135.     cmp.b    #13,d1
  136.     beq    eofname        ;carriag return => end
  137.     move.b    d1,(a1)+
  138.     bra    copyname
  139. eofname:
  140.     clr.b    (a1)        ;zero-byte to end filename
  141.     move.l    a1,a0        ;keep end of filename
  142.     cmp.b    #34,-(a1)    ;drop " - char at the end
  143.     beq    droplast
  144.     cmp.b    #39,(a1)    ;drop ' - char at the end
  145.     bne    lookparam
  146. droplast:
  147.     clr.b    (a1)
  148. lookparam:
  149.     suba.l    #4,a0 
  150.     cmp.b    #44,(a0)    ;look for ','
  151.     beq    gotparam
  152.     adda.l    #1,a0
  153.     cmp.b    #44,(a0)
  154.     bne    gotfilename    ;no ',' ... no parameter
  155. gotparam:
  156.     move.b    1(a0),d0    ;get type of parameter
  157.     move.b    2(a0),d1    ;get one digit of parameter
  158.     move.b    3(a0),d2    ;get onother digit of the parameter
  159.     clr.b    (a0)+
  160.     clr.b    (a0)+        ;delete paramter from filename
  161.     clr.b    (a0)+
  162.     clr.b    (a0)
  163.     cmp.b    #35,d0        ;look for '#' to indicate repeat-parameter
  164.     beq    gotrepeatparam
  165.     cmp.b    #38,d0        ;look for '&' to indicate time-parameter
  166.     bne    gotfilename    ;(here there's no difference between # and &)
  167. gotrepeatparam:
  168.     tst.b    d2        ;is there only one digit ?
  169.     bne    twodigits
  170.     sub.b    #48,d1
  171.     move.b    d1,time        ;get value of parameter and save it
  172.     bra    gotfilename
  173. twodigits:
  174.     moveq    #0,d3
  175.     sub.b    #48,d1
  176.     sub.b    #48,d2        ;get value of two-digit parameter
  177.     mulu    #10,d1
  178.     move.b    d1,d3
  179.     add.b    d2,d3        ;and save it
  180.     move.b    d3,time
  181.     bra    gotfilename
  182.  
  183. ; get parameters if programm is started from wb
  184.  
  185. wbstart:
  186.     lea    $5c(a4),a0    ;pointer to task's message-port 
  187.     jsr    Waitport(a6)    ;wait for wb-start-message
  188.     lea    $5c(a4),a0
  189.     jsr    GetMsg(a6)    ;get wb-start-message
  190.     move.l    d0,startmsg
  191.     beq    nofile        ;no message ? ... strange !
  192.     move.l    d0,a0
  193.     cmp.l    #1,$1c(a0)    ;number of arguments < 1 ... nofilename
  194.     bls    nofile
  195.     move.l    $24(a0),a2    ;pointer to list of segments (picked icons)
  196.     beq    nofile        ;... very strange !
  197.     move.l    8(a2),d1    ;pointer to directory of text(?)-icon
  198.     beq    noselectdir
  199.     move.l    dosbase,a6
  200.     jsr    CurrentDir(a6)    ;actual dir => new dir
  201.     move.l    d0,d1
  202.     beq    noselectdir
  203.     jsr    UnLock(a6)
  204. noselectdir:
  205.     move.l    12(a2),d0    ;pointer to filename
  206.     beq    nofile        ;... no filename !
  207.     move.l    d0,a0
  208.     tst.b    (a0)        ;get first character of filename
  209.     beq    nofile        ;... still very strange !
  210.     bra    getfilename    ;well then get the filename
  211.  
  212. ; well ... now we open the window !
  213.  
  214. nofile:
  215.     bset    #0,pltflag
  216. gotfilename:
  217.     move.l    intuibase,a6
  218.     lea    wplt,a0        ;open display-window
  219.     jsr    OpenWindow(a6)
  220.     move.l    d0,wdwhandle    ;keep wdwhandle
  221.     beq    quitpltdisplay
  222.     move.l    d0,a0
  223.     move.l    50(a0),wdwrast    ;keep rastport
  224.     bsr    dowindow    ;draw the wonderful pltdisplay-window
  225.     btst    #0,pltflag
  226.     bne    waitmessage    ;did we get one file to start ?
  227.  
  228. ; now we load one picture (?) - file
  229.  
  230. gotloadfile:
  231.     bsr    pltworkon    ;set 'working-pointer'
  232.     bsr    droppicscreen
  233.     lea    filename,a0    ;filename-pointer
  234.     move.l    #$10001,d0    ;type of memory: public/clear
  235.     bsr    loadfile    ;one file-load-routine
  236.     move.l    d0,long        ;keep length of data
  237.     beq    exitshowpic    ;data length = 0 ... really very strange !
  238.     move.l    a0,iffmem    ;data-adress-pointer
  239.     bsr    dowindow    ;and redisplay the window
  240.  
  241. ; get memory for bitplanes, open screen and display picture
  242.  
  243.     move.l    iffmem,a2
  244.     move.l    long,d0
  245.     cmp.l    #"ILBM",8(a2)    ;look if this really is on IFF-Picture
  246.     bne    exitshowpic
  247.     lsr.l    #1,d0        ;length of file /2 as counter
  248. lookbmhd:
  249.     cmp.l    #"BMHD",(a2)
  250.     beq    foundbmhd    ;look for bitmap-header-chunk
  251.     adda.l    #2,a2
  252.     subq.l    #1,d0
  253.     bne    lookbmhd
  254.     bra    exitshowpic
  255. foundbmhd:
  256.     bclr    #0,flags    ;nohires
  257.     bclr    #1,flags    ;unpacked
  258.     adda.l    #4,a2
  259.     lea    screen,a0
  260.     lea    tx2,a1    
  261.     clr.w    12(a0)        ;ViewModes
  262.     move.w    #200,6(a0)    ;screen-height: 200 ???
  263.     move.l    #"200 ",18(a1)
  264.     move.w    6(a2),height    ;picture-height
  265.     cmp.w    #200,6(a2)
  266.     bls    gotheight
  267.     move.l    graphbase,a6
  268.     cmp.w    #1,206(a6)    ;NTSC-mode ???
  269.     beq    ntscmode
  270.     move.w    #256,6(a0)    ;screen-height: 256 ???
  271.     move.l    #"256 ",18(a1)
  272.     cmp.w    #256,6(a2)
  273.     bls    gotheight    ;if not then ...
  274. ntscmode:
  275.     or.w    #4,12(a0)    ;ViewMode: Interlace
  276.     move.w    #400,6(a0)
  277.     move.l    #"400 ",18(a1)    ;screen-height: 400 ???
  278.     cmp.w    #400,6(a2)
  279.     bls    gotheight
  280.     cmp.w    #1,206(a6)    ;NTSC-mode ???
  281.     beq    gotheight
  282.     move.w    #512,6(a0)    ;if not then ...
  283.     move.l    #"512 ",18(a1)    ;screen-height: 512 !!!
  284. gotheight:
  285.     move.w    #320,4(a0)    ;screen-width: 320 ???
  286.     move.l    #"320 ",12(a1)
  287.     move.w    4(a2),width    ;picture-width
  288.     cmp.w    #320,4(a2)
  289.     bls    gotwidth    ;in not then ...
  290.     move.w    #640,4(a0)
  291.     move.l    #"640 ",12(a1)    ;screen-width: 640 !!!
  292.     bset    #0,flags    ;and ...
  293.     or.w    #$8000,12(a0)    ;ViewMode: HiRes
  294. gotwidth:
  295.     moveq    #0,d0
  296.     move.b    12(a2),d0    ;get depth of picture
  297.     move.w    d0,8(a0)
  298.     move.w    d0,depth
  299.     add.b    #48,d0
  300.     move.b    d0,31(a1)    ;display depth in PLTDisplay-Window
  301.     tst.b    14(a2)
  302.     beq    unpacked    ;get packed/unpacked-flag
  303.     bset    #1,flags
  304. unpacked:
  305.     move.l    iffmem,a2
  306.     move.l    long,d0
  307.     lsr.l    #1,d0        ;look if there is on CAMG-chunk
  308. lookcamg:
  309.     cmp.l    #"CAMG",(a2)
  310.     beq    foundcamg
  311.     adda.l    #2,a2
  312.     subq.l    #1,d0
  313.     bne    lookcamg
  314.     bra    nocamg
  315. foundcamg:            ;if yes... then get
  316.     adda.l    #8,a2        ;ViewModes out if CAMG-chunk 
  317.     move.l    (a2),d0        ;but also keep ('or') ViewModes
  318.     or.w    d0,12(a0)    ;based on picture-dimensions
  319. nocamg:
  320.     cmp.w    #4,depth    ;if depth is larger than 4
  321.     bls    dontworrymodes
  322.     move.w    12(a0),d0    ;kill hires-bit in viewmodes
  323.     bclr    #15,d0
  324.     move.w    d0,12(a0)    ;and width has to be 320
  325.     move.w    #320,4(a0)
  326.     move.l    #"320 ",12(a1)
  327. dontworrymodes:
  328.     moveq    #0,d5        ;get width of bitplanes
  329.     move.w    width,d5
  330.     move.w    4(a0),pwidth    ;if the picture is smaller
  331.     cmp.w    pwidth,d5
  332.     bls    gotpwidth    ;than the the screen the bitplane 
  333.     divu    #16,d5
  334.     move.l    d5,d3        ;is as large as the screen, if not
  335.     lsr.l    #8,d3
  336.     lsr.l    #8,d3        ;well then ... the bit plane is
  337.     tst.w    d3
  338.     beq    equalpwidth    ;as large as the picture but it also
  339.     addq.w    #1,d5
  340. equalpwidth:            ;has to be a multiple of 16 (or ???)
  341.     asl.l    #4,d5
  342.     move.w    d5,pwidth
  343. gotpwidth:
  344.     moveq    #0,d5
  345.     move.w    height,d5    ;get height of bitplanes
  346.     move.w    6(a0),pheight
  347.     cmp.w    pheight,d5    ;(philosophy... see above)
  348.     bls    gotpheight
  349.     move.w    d5,pheight        
  350. gotpheight:
  351.     move.l    graphbase,a6
  352.     lea    bitmap,a0
  353.     move.w    depth,d0    ;init BitMap-struct
  354.     move.w    pwidth,d1
  355.     move.w    pheight,d2
  356.     jsr    InitBitMap(a6)
  357.     move.w    depth,d5
  358.     subq.w    #1,d5
  359.     lea    planes,a5    ;pointer to table of bplanes
  360.     lea    bitmap,a4    ;pointer to bplanes in bmap-struct
  361.     adda.l    #8,a4
  362. getplanes:
  363.     move.w    pwidth,d0    ;get memory for all bplanes
  364.     move.w    pheight,d1
  365.     jsr    AllocRaster(a6)
  366.     tst.l    d0
  367.     beq    exitshowpic
  368.     move.l    d0,(a5)+    ;and save the bplane-adresses
  369.     move.l    d0,(a4)+
  370.     dbra    d5,getplanes
  371.     move.l    intuibase,a6
  372.     lea    screen,a0    ;and finaly open the screen
  373.     jsr    OpenScreen(a6)
  374.     move.l    d0,iffscreen    ;keep screen-handle
  375.     beq    exitshowpic    ;no screen ... no picture
  376.     move.l    d0,clscr
  377.     add.l    #44,d0
  378.     move.l    d0,iffview    ;keep pointer to screen-viewport
  379.     lea    wscrclose,a0
  380.     jsr    OpenWindow(a6)    ;open 'close'-window on pic-screen
  381.     move.l    d0,wscrclosehl
  382.     move.l    graphbase,a6
  383.     move.l    iffscreen,a1
  384.     adda.l    #84,a1        ;pointer to screen-rastport
  385.     moveq    #0,d0
  386.     jsr    SetRast(a6)    ;fill rastport with color 0
  387.     move.l    iffmem,a2
  388.     move.l    long,d0
  389.     lsr.l    #1,d0
  390. lforcolchunk:
  391.     cmp.l    #"CMAP",(a2)    ;look for CMAP-chunk in iff-file
  392.     beq    foundcolch
  393.     adda.l    #2,a2
  394.     subq.l  #1,d0
  395.     bne    lforcolchunk
  396.     bra    nocolorchunk
  397. foundcolch:
  398.     move.l    graphbase,a6    ;iff there is one color-chunk in
  399.     adda.l    #4,a2
  400.     move.l    (a2)+,d4
  401.     divu    #3,d4
  402.     subq.w    #1,d4        ;the iff-file...
  403.     moveq    #0,d5
  404. setcolchloop:
  405.     move.l    iffview,a0
  406.     move.l    d5,d0
  407.     moveq    #0,d1
  408.     moveq    #0,d2
  409.     moveq    #0,d3        ;then restore all the
  410.     move.b    (a2)+,d1
  411.     lsr.b    #4,d1
  412.     move.b    (a2)+,d2
  413.     lsr.b    #4,d2        ;wonderfull colors
  414.     move.b    (a2)+,d3
  415.     lsr.b    #4,d3
  416.     jsr    SetRGB4(a6)
  417.     addq.l    #1,d5
  418.     dbra    d4,setcolchloop
  419. nocolorchunk:
  420.     moveq    #0,d0
  421.     moveq    #0,d1
  422.     move.w    width,d0    ;get width in bytes
  423.     divu    #8,d0
  424.     move.w    d0,d1
  425.     lsr.l    #8,d0
  426.     lsr.l    #8,d0
  427.     tst.w    d0
  428.     beq    equalwidth1
  429.     addq.w    #1,d1
  430. equalwidth1:
  431.     move.l    d1,d0
  432.     divu    #2,d0        ;and width in bytes HAS TO BE (???)
  433.     lsr.l    #8,d0
  434.     lsr.l    #8,d0        ;equal (I am really not sure !)
  435.     tst.w    d0
  436.     beq    equalwidth2
  437.     addq.w    #1,d1
  438. equalwidth2:
  439.     move.w    d1,widthbytes
  440.     move.l    iffmem,a6
  441.     move.l    long,d0
  442.     lsr.l    #1,d0
  443. lforpbody:
  444.     cmp.l    #"BODY",(a6)    ;look for body-chunk
  445.     beq    foundpbody
  446.     adda.l    #2,a6
  447.     subq.l    #1,d0
  448.     bne    lforpbody
  449.     bra    exitshowpic
  450. foundpbody:
  451.     adda.l    #8,a6        ;begin of body-chunk
  452.     moveq    #0,d7
  453.     move.w    height,d7
  454.     subq.w    #1,d7        ;number of lines as counter
  455.     moveq    #0,d6
  456. setpiloop1:
  457.     moveq    #0,d5
  458.     move.w    depth,d5    ;number of planes as counter for
  459.     subq.l    #1,d5        ;inner loop
  460.     lea    bitmap,a0
  461.     adda.l    #8,a0        ;pointer to table of bitmap-pointers
  462. setpiloop2:
  463.     move.l    (a0),a1        ;get adress of first bitmap
  464.     move.l    d6,d0        ;number of actual line
  465.     moveq    #0,d1
  466.     move.w    pwidth,d1
  467.     lsr.w    #3,d1        ;* bytes per display-line
  468.     mulu    d1,d0
  469.     adda.l    d0,a1        ;= pointer to actual line
  470.     moveq    #0,d4
  471.     move.w    widthbytes,d4    ;width in bytes as counter for
  472.     subq.w    #1,d4        ;main loop
  473. setpiloop3:
  474.     btst    #1,flags    ;is this picture packed ???
  475.     bne    packeddata
  476.     move.b    (a6)+,(a1)+    ;well then ... easy going
  477.     dbra    d4,setpiloop3
  478.     bra    nextsetplane
  479. packeddata:
  480.     moveq    #0,d0
  481.     move.b    (a6)+,d0    ;read next data-byte
  482.     cmp.b    #$80,d0        ;is this one no-option-fill-byte ???
  483.     bne    nonoopbyte    ;no ... then look what is it for
  484.     subq.l    #1,d4
  485.     bmi    nextsetplane    ;go on ...
  486.     bra    setpiloop3
  487. nonoopbyte:
  488.     tst.b    d0
  489.     bpl    setunpacked    ;next d0-bytes are unpacked
  490.     neg.b    d0        ;neg d0 to get number of equal bytes
  491.     move.b    (a6)+,d1    ;read the byte
  492. setpacked:
  493.     move.b    d1,(a1)+    ;write byte into bitplane
  494.     subq.l    #1,d4        ;sub byte-counter
  495.     bmi    nextsetplane    ;negative counter => line is ready
  496.     dbra    d0,setpacked    ;go on writing the same byte
  497. nextsetpack:
  498.     tst.l    d4        ;positive counter => read next byte
  499.     bpl    setpiloop3
  500.     bra    nextsetplane    ;ready line ... same line, next plane
  501. setunpacked:
  502.     move.b    (a6)+,(a1)+    ;copy unpacked bytes in bplane
  503.     subq.l    #1,d4
  504.     bmi    nextsetplane    ;count down the counter
  505.     dbra    d0,setunpacked
  506.     bra    nextsetpack    ;and go on reading the data
  507. nextsetplane:
  508.     adda.l    #4,a0        ;pointer to next plane
  509.     dbra    d5,setpiloop2
  510.     addq.l    #1,d6        ;number of line plus 1
  511.     dbra    d7,setpiloop1
  512. exitshowpic:
  513.     bsr    pltworkoff    ;drop work-pointer
  514.     bsr    dowindow    ;display the PLTDisplay-window
  515.  
  516. ; waiting for user-interaction
  517.  
  518. waitmessage:
  519.     tst.b    time
  520.     beq    noparadrive
  521.     move.l    dosbase,a6    ;look if there was a parameter
  522.     moveq    #0,d1
  523.     move.b    time,d1        ;delivered, when the programm was
  524.     mulu    #50,d1
  525.     jsr    Delay(a6)    ;started
  526.     bra    quitpltdisplay
  527. noparadrive:
  528.     move.l    4,a6        ;is there is a picture-screen, with a
  529.     tst.l    wscrclosehl    ;little close-window in the upper left
  530.     bne    twowindows
  531.     move.l    wdwhandle,a0
  532.     move.l    86(a0),a0    ;window-user-port
  533.     jsr    WaitPort(a6)    ;waiting for intuimessage
  534.     bra    nodroppic
  535. twowindows:
  536.     move.l    wscrclosehl,a0    ;look if 'close'-window was activated
  537.     move.l    86(a0),a0    ;window user-port
  538.     jsr    GetMsg(a6)    ;get intuimessage
  539.     tst.l    d0
  540.     beq    nodroppic    ;no activation ... go on
  541.     move.l    d0,a1
  542.     jsr    ReplyMsg(a6)
  543.     bsr    droppicscreen    ;close picture-screen and drop memory
  544.     bra    waitmessage
  545. nodroppic:
  546.     move.l    wdwhandle,a0
  547.     move.l    86(a0),a0    ;window user-port
  548.     jsr    GetMsg(a6)    ;get intuimessage
  549.     tst.l    d0
  550.     beq    waitmessage    ;there wasn't one ... stra...
  551.     move.l    d0,a1
  552.     move.l    20(a1),d6    ;get idcmp-code of event
  553.     move.l    28(a1),a3    ;get (possibly) adress of gadget
  554.     move.w    24(a1),d5    ;get (possibly) raw-key-code    
  555.     move.w    26(a1),d4    ;get (possibly) qualifier
  556.     jsr    ReplyMsg(a6)    ;and reply message
  557.     cmp.l    #$40,d6
  558.     bne    noupgadgetmsg    ;wasn't any gadget at all
  559.     cmpa.l    #gdgquit,a3    ;quit this wonderfull programm ?
  560.     beq    quitpltdisplay
  561.     cmpa.l    #gdgload1,a3    ;request for new file to laod ?
  562.     beq    gotloadfile
  563.     cmpa.l    #gdghelp,a3    ;request for help-window ?
  564.     bne    waitmessage
  565.     bsr    plthelp
  566.     bra    waitmessage
  567. noupgadgetmsg:            ;no gadget... that means a key ;-)
  568.     cmp.w    #$4e,d5
  569.     beq    scrollright    ;'CRSR ->' - scroll display right
  570.     cmp.w    #$4f,d5
  571.     beq    scrollleft    ;'CRSR <-' - scroll display left
  572.     cmp.w    #$4c,d5
  573.     beq    scrollup    ;'CRSR up' - scroll display up
  574.     cmp.w    #$4d,d5
  575.     beq    scrolldown    ;'CRSR dn' - scroll display down
  576.     cmp.w    #$45,d5
  577.     beq    quitpltdisplay    ;'esc' - quit programm ?
  578.     cmp.w    #$5f,d5
  579.     bne    waitmessage
  580.     bsr    plthelp        ;'Help' - show help window
  581.     bra    waitmessage
  582.  
  583. ; close a picture-screen and free picture-memory
  584.  
  585. droppicscreen:
  586.     move.l    intuibase,a6
  587.     tst.l    wscrclosehl    ;look if there is a 'close'-window
  588.     beq    nooldwclose
  589.     move.l    wscrclosehl,a0    ;and close it
  590.     jsr    CloseWindow(a6)
  591.     clr.l    wscrclosehl
  592. nooldwclose:
  593.     tst.l    iffscreen    ;look if there still is a screen
  594.     beq    nooldscreen
  595.     move.l    iffscreen,a0
  596.     jsr    CloseScreen(a6)    ;if yes, then close it
  597.     clr.l    iffscreen
  598.     bsr    freeplanes    ;and free bitplane-memory
  599. nooldscreen:
  600.     move.l    4,a6
  601.     move.l    iffmem,a1
  602.     move.l    long,d0
  603.     beq    nooldsongmem
  604.     jsr    FreeMem(a6)    ;free old data memory
  605.     clr.l    iffmem        ;and clear pointers
  606.     clr.l    long
  607. nooldsongmem:
  608.     rts
  609.  
  610. ; scroll disply if dimensions of picture are larger than screen
  611.  
  612. scrollright:
  613.     bsr    getoffsets    ;get actual offsets
  614.     add.w    d0,d2
  615.     cmp.w    pwidth,d2    ;look if there is something to show
  616.     bge    waitmessage    ;on the right
  617.     move.w    pwidth,d4
  618.     sub.w    d2,d4
  619.     cmp.w    #32,d4        ;scroll-right a maximum of 32 pixels
  620.     bls    gotscrright
  621.     move.w    #32,d4
  622. gotscrright:
  623.     add.w    d4,d0
  624.     bra    doscroll
  625.  
  626. scrollleft:
  627.     bsr    getoffsets
  628.     tst.w    d0
  629.     beq    waitmessage
  630.     move.w    d0,d4
  631.     cmp.w    #32,d4        ;see above
  632.     bls    gotscrleft
  633.     move.w    #32,d4
  634. gotscrleft:
  635.     sub.w    d4,d0
  636.     bra    doscroll
  637.  
  638. scrolldown:
  639.     bsr    getoffsets
  640.     add.w    d1,d3
  641.     cmp.w    pheight,d3
  642.     bge    waitmessage
  643.     move.w    pheight,d5
  644.     sub.w    d3,d5
  645.     cmp.w    #32,d5        ;see above
  646.     bls    gotscrdown
  647.     move.w    #32,d5
  648. gotscrdown:
  649.     add.w    d5,d1
  650.     bra    doscroll
  651. scrollup:
  652.     bsr    getoffsets
  653.     tst.w    d1
  654.     beq    waitmessage
  655.     move.w    d1,d5
  656.     cmp.w    #32,d5        ;see above
  657.     bls    gotscrup
  658.     move.w    #32,d5
  659. gotscrup:
  660.     sub.w    d5,d1
  661.     bra    doscroll
  662.  
  663. getoffsets:
  664.     move.l    iffscreen,a0
  665.     move.w    12(a0),d2    ;width of screen
  666.     move.w    14(a0),d3    ;height of screen
  667.     adda.l    #80,a0
  668.     move.l    (a0),a1
  669.     move.w    8(a1),d0    ;left offset
  670.     move.w    10(a1),d1    ;top offset
  671.     rts
  672.  
  673. doscroll:
  674.     move.w    d0,8(a1)    ;write new left offset
  675.     move.w    d1,10(a1)    ;write new top offset
  676.     move.l    graphbase,a6
  677.     move.l    iffview,a0
  678.     jsr    ScrollVPort(a6)    ;remake viewport-display
  679.     bra    waitmessage
  680.  
  681. ; quit this wonderfull program ...
  682.  
  683. quitpltdisplay:
  684.     move.l    intuibase,a6
  685.     tst.l    wdwhandle
  686.     beq    nowdwclose
  687.     move.l    wdwhandle,a0    ;close the wonderfull PLTDisplay-Window
  688.     jsr    CloseWindow(a6)
  689. nowdwclose:    
  690.     bsr    droppicscreen    ;close the picture-screen
  691.     move.l    4,a6
  692.     tst.l    dosbase
  693.     beq    nodropdos
  694.     move.l    dosbase,a1
  695.     jsr    CloseLibrary(a6)    ;close dos_lib
  696. nodropdos:
  697.     tst.l    graphbase
  698.     beq    nodropgraph
  699.     move.l    graphbase,a1
  700.     jsr    CloseLibrary(a6)    ;close graph_lib
  701. nodropgraph:
  702.     tst.l    intuibase
  703.     beq    nodropintui
  704.     move.l    intuibase,a1
  705.     jsr    CloseLibrary(a6)    ;close intui_lib
  706. nodropintui:
  707.     tst.l    infomem
  708.     beq    nodropinfomem
  709.     move.l    #1024,d0
  710.     move.l    infomem,a1
  711.     jsr    FreeMem(a6)    ;drop infomem
  712. nodropinfomem:
  713.     tst.l    startmsg
  714.     beq    quitpltdisplayprog
  715.     move.l    startmsg,a1    ;if there is an wb-start-message
  716.     jsr    ReplyMsg(a6)    ;reply it
  717. quitpltdisplayprog:
  718.     moveq    #0,d0
  719.     moveq    #0,d1
  720.     move.l    startsp,sp
  721.     rts            ;and ... that's the end of pltdisplay
  722.  
  723. ; free memory for bitplanes
  724.  
  725. freeplanes:
  726.     move.l    graphbase,a6
  727.     moveq    #5,d5        ;free a maximum of 6 bitplanes
  728.     lea    planes,a5
  729. freeploop:
  730.     move.l    (a5),d0        ;was this the last plane ???
  731.     beq    exitplanefree
  732.     move.l    d0,a0
  733.     move.w    pwidth,d0
  734.     move.w    pheight,d1
  735.     jsr    FreeRaster(a6)    ;free memory
  736. nextplanefree:
  737.     clr.l    (a5)+
  738.     dbra    d5,freeploop
  739. exitplanefree:
  740.     rts
  741.  
  742. ; loadfile-routine, gets length of file, allocates mem and finally loads it
  743.  
  744. loadfile:
  745.     movem.l    d1-d7/a1-a6,-(sp)
  746.     move.l    a0,a5        ;keep pointer to filename
  747.     move.l    d0,d5        ;keep mem-type
  748.     move.l    dosbase,a6
  749.     move.l    a5,d1
  750.     moveq    #-2,d2        ;lock-mode = -2 ... read !
  751.     jsr    Lock(a6)    ;get filelock
  752.     move.l    d0,d7        ;keep pointer to filelock
  753.     beq    lerror1        ;no lock ... error !
  754.     move.l    dosbase,a6
  755.     move.l    d7,d1        ;filelock
  756.     move.l    infomem,d2    ;info-memory
  757.     jsr    Examine(a6)    ;examine file-info-data
  758.     tst.l    d0        ;d0 = 0 ? ... Error !
  759.     beq    lerror1
  760.     move.l    d7,d1        ;drop filelock
  761.     jsr    UnLock(a6)
  762.     move.l    infomem,a3
  763.     move.l    124(a3),d0    ;get length of file
  764.     addq.l    #2,d0        ;we want some zero-bytes at the end
  765.     move.l    4,a6
  766.     move.l    d5,d1        ;get requested mem-type
  767.     jsr    AllocMem(a6)    ;allocate memory
  768.     move.l    d0,a2        ;keep memory-pointer
  769.     tst.l    d0        ;no memory ... error !
  770.     beq    lerror1
  771.     move.l    a5,d1        ;filename-pointer
  772.     move.l    #1005,d2    ;open-mode: old
  773.     move.l    dosbase,a6
  774.     jsr    Open(a6)    ;open file
  775.     move.l    d0,d4        ;keep filehandle
  776.     beq    lerror1        ;filehandle = 0 ? ... error !
  777.     move.l    d0,d1
  778.     move.l    a2,d2        ;memory-pointer
  779.     move.l    124(a3),d3    ;length of file
  780.     jsr    Read(a6)    ;read file
  781.     move.l    d4,d1
  782.     jsr    Close(a6)    ;close file
  783.     move.l    124(a3),d4    ;keep length of file
  784.     addq.l    #2,d4        ;we still want some zero-bytes at the end
  785.     move.l    a2,a0        ;data-pointer in a0
  786.     move.l    d4,d0        ;length of data in d0
  787. exitloadfile:
  788.     movem.l    (sp)+,d1-d7/a1-a6
  789.     rts            ;we are ready !
  790. lerror1:
  791.     moveq    #0,d0        ;d0 = 0 ... that means one error
  792.     bra    exitloadfile    ;and we are ready too !
  793.  
  794. ; get ascii out of integer (textpointer => a0, integer => d0)
  795.  
  796. getascii:
  797.     moveq    #16,d1
  798.     divu    #1000,d0    ;digit of thousands
  799.     addi.b    #48,d0        ;get ascci-code
  800.     move.b    d0,(a0)+
  801.     lsr.l    d1,d0        ;keep the rest
  802.     divu    #100,d0        ;digit of hundreds
  803.     addi.b    #48,d0
  804.     move.b    d0,(a0)+    ;and so on ...
  805.     lsr.l    d1,d0
  806.     divu    #10,d0
  807.     addi.b    #48,d0
  808.     move.b    d0,(a0)+
  809.     lsr.l    d1,d0
  810.     addi.b    #48,d0
  811.     move.b    d0,(a0)+
  812.     rts
  813.  
  814. ; display the wonderfull pltdisplay-help-window
  815.  
  816. plthelp:
  817.     move.l    intuibase,a6
  818.     lea    wabout,a0    ;open help-window
  819.     jsr    OpenWindow(a6)
  820.     move.l    d0,d7        ;keep wdwhandle
  821.     beq    quitplthelp    ;no window ! ... that's unbeliveable
  822.     move.l    graphbase,a6
  823.     move.l    d7,a1
  824.     move.l    50(a1),a1
  825.     moveq    #2,d0        ;set pen to color 2
  826.     jsr    SetAPen(a6)
  827.     move.l    d7,a1
  828.     move.l    50(a1),a1
  829.     moveq    #2,d0        ;rect allmost the whole window
  830.     moveq    #1,d1
  831.     move.w    #537,d2
  832.     move.w    #188,d3
  833.     jsr    RectFill(a6)
  834.     move.l    intuibase,a6
  835.     moveq    #20,d3        ;y-pos of first line
  836.     lea    helptx,a5    ;pointer to help-lines
  837.     moveq    #16,d5        ;20 lines to print
  838. plthelploop1:
  839.     lea    texttext,a4    ;memory for text-line
  840.     moveq    #-1,d6        ;counter for length to pre-zero
  841. plthelploop2:
  842.     addq.w    #1,d6        ;count one more character
  843.     move.b    (a5)+,(a4)+    ;copy it
  844.     bne    plthelploop2    ;not zero ... go on copying
  845.     asl.w    #3,d6        ;8 points per char 
  846.     move.w    #540,d0        ;width of window
  847.     sub.w    d6,d0        ;sub width of text
  848.     lsr.w    #1,d0        ;and divide through 2 to center
  849.     move.l    d7,a0
  850.     move.l    50(a0),a0    ;window-rastport
  851.     lea    textline,a1    ;text-struct
  852.     move.b    #2,1(a1)    ;set background-color to color 2
  853.     move.l    d3,d1        ;get y-pos
  854.     jsr    PrintIText(a6)    ;and print the line
  855.     add.w    #9,d3        ;add 9 to y-pos
  856.     dbra    d5,plthelploop1    ;and go on printing
  857.     lea    textline,a1    ;as the same text-struct is used to display
  858.     clr.b    1(a1)        ;the 'real' text reset back-col to 0
  859.     bclr    #2,pltflag    ;clear flag (see below for the sense of it)
  860. plthelpwait:
  861.     move.l    4,a6
  862.     move.l    d7,a0
  863.     move.l    86(a0),a0    ;window-user-port
  864.     jsr    WaitPort(a6)    ;wait for message ... task is sleeping
  865.     move.l    d7,a0
  866.     move.l    86(a0),a0
  867.     jsr    GetMsg(a6)    ;now ... there's one user-request !
  868.     tst.l    d0
  869.     beq    plthelpwait    ;no ...there's none ... (...strange!)
  870.     move.l    d0,a1
  871.     move.l    20(a1),d6    ;get idcmp of message-cause
  872.     jsr    ReplyMsg(a6)    ;and send message back
  873.     cmp.l    #$8,d6        ;did the user (got bless him/her)
  874.     beq    helpmousepick    ;press one mouse-button ?
  875.     btst    #2,pltflag    ;drop the first key, which possibly opened
  876.     bne    helpmousepick    ;the window (a strange way to avoid that
  877.     bset    #2,pltflag    ;the window is closed at once if it was
  878.     bra    plthelpwait    ;called with the help-key)
  879. helpmousepick:
  880.     move.l    intuibase,a6
  881.     move.l    d7,a0
  882.     jsr    CloseWindow(a6)    ;well ... close the help-window, o.k. ???
  883. quitplthelp:
  884.     rts
  885.  
  886. ; display the wonderfull pltdisplay-window
  887.  
  888. dowindow:
  889.     lea    screen,a1
  890.     lea    tx3,a0
  891.     move.l    #"    ",36(a0)    ;clear 'type of picture'
  892.     move.w    12(a1),d0
  893.     btst    #7,d0
  894.     beq    noehb
  895.     move.l    #"EHB ",36(a0)    ;one extra halve bright picture ?
  896. noehb:
  897.     btst    #11,d0
  898.     beq    noham
  899.     move.l    #"HAM ",36(a0)    ;one hold and modify picture ?
  900. noham:
  901.     moveq    #0,d0
  902.     move.w    width,d0
  903.     adda.l    #7,a0
  904.     bsr    getascii    ;get width of picture
  905.     moveq    #0,d0
  906.     move.w    height,d0
  907.     lea    tx3,a0
  908.     adda.l    #21,a0        ;get height of picture
  909.     bsr    getascii
  910.     lea    fields,a5    ;table of rects
  911.     moveq    #4,d7        ;number of rects -1
  912.     move.l    wdwrast,dorast
  913.     bsr    dofields    ;display some rects
  914.     lea    texte,a5    ;table of texts
  915.     moveq    #2,d7        ;number of texts -1
  916.     bsr    dotexts        ;print some texts
  917.     lea    gdgquit,a0
  918.     move.l    intuibase,a6
  919.     move.l    wdwhandle,a1
  920.     move.l    #0,a2        ;remake the gadgets (... strings)
  921.     jsr    RefreshGadgets(a6)
  922.     rts
  923.  
  924. ; variables, texts, names, flags, handles, pointers and so on ...
  925.  
  926. dosname:    dc.b    "dos.library",0
  927.         even
  928. intuiname:    dc.b    "intuition.library",0
  929.         even
  930. graphname:    dc.b    "graphics.library",0
  931.         even
  932. bitmap:        ds.l    11    ;bitmap-struct
  933. infomem:    dc.l    0
  934. dosbase:    dc.l    0
  935. intuibase:    dc.l    0    ;library-handles
  936. graphbase:    dc.l    0
  937. wdwhandle:    dc.l    0    ;windowhandle
  938. wscrclosehl:    dc.l    0
  939. iffscreen:    dc.l    0    ;screenhandle
  940. wdwrast:    dc.l    0    ;windowrastport
  941. dorast:        dc.l    0    ;rastport for rect-routine
  942. thistask:    dc.l    0    ;pointer to task struct
  943. startsp:    dc.l    0    ;stackpointer when programm is started
  944. startmsg:    dc.l    0    ;wb-startup-message-handle
  945. iffmem:        dc.l    0    ;pointer to memory for sound 1
  946. long:        dc.l    0    ;length of the sound
  947. memo1:        dc.l    0    ;one longword to keep s.th. in
  948. memo2:        dc.w    0    ;one word to keep s.th. in
  949. iffview:    dc.l    0    ;pointer to viewport-struct
  950. planes:        ds.l    6    ;pointers to up to 6 bitplanes
  951. height:        dc.w    0    ;height of picture
  952. depth:        dc.w    0    ;depth of picture
  953. width:        dc.w    0    ;width of picture
  954. pwidth:        dc.w    0    ;width of bitmap/display 
  955. pheight:    dc.w    0    ;height of bitmap/display
  956. widthbytes:    dc.w    0    ;width of display in bytes
  957. fieldheight:    dc.w    0    ;height of rect to draw
  958. pltflag:    dc.b    0    ;one byte to keep s.th. in
  959. flags:        dc.b    0    ;flags for packed/npacked & hires/nohires
  960. time:        dc.b    0
  961.         even
  962.  
  963. ;table of dimensions of the rectangles that make the window-look
  964.  
  965. fields:    dc.w    2,10,337,52,2
  966.     dc.w    13,15,167,10,0
  967.     dc.w    186,15,40,10,2
  968.     dc.w    233,15,51,10,2
  969.     dc.w    290,15,40,10,2
  970.  
  971. ;table of texts and their positions that make the window-look
  972.  
  973. texte:    dc.w    190,17
  974.     dc.l    tx1
  975.     dc.w    11,33
  976.     dc.l    tx2
  977.     dc.w    14,48
  978.     dc.l    tx3
  979.  
  980. tx1:    dc.b    "LOAD  ABOUT  QUIT",0
  981.     even
  982. tx2:    dc.b    "Resolution:     *       Depth:   BPlanes",0
  983.     even
  984. tx3:    dc.b    "Width:       Height:       Special:     ",0
  985.     even
  986.  
  987. ;help-message
  988.  
  989. helptx:
  990.  dc.b    "-----=== Platinum-Display-Replacement - PLTDisplay ===-----",0
  991.  dc.b    " ",0
  992.  dc.b    "© 1991 by Joerg Schliesser / Platinum Softwareline",0
  993.  dc.b    "Rotenwaldstrasse 20 / D-7000 Stuttgart 1 / Germany",0
  994.  dc.b    "PLTDisplay is freely distributable. (Only on disks,",0
  995.  dc.b    "distributed in a non-commercial sense) Refer to PLTTools.doc.",0
  996.  dc.b    "As long as this text remains unchanged",0
  997.  dc.b    " ",0
  998.  dc.b    "Click upper left corner of picture-screen to close screen",0
  999.  dc.b    " ",0
  1000.  dc.b    "Click 'normal' position of depth-gadgets on picture-screen ",0
  1001.  dc.b    "to put screen to back/front",0
  1002.  dc.b    " ",0
  1003.  dc.b    "Use cursor-keys to scroll the display if width and/or",0
  1004.  dc.b    "height of picture are larger than resolution of the screen",0
  1005.  dc.b    " ",0
  1006.  dc.b    "To close this window press any key or mouse button",0
  1007.     even
  1008.  
  1009. textline:
  1010.     dc.b    1,0,1
  1011.     even
  1012.     dc.l    0,0,texttext,0
  1013. texttext:    ds.b    80
  1014.  
  1015. txtext:        dc.b    1,0,0
  1016.         even
  1017.         dc.l    0,0
  1018. txtextpoint:    dc.l    0,0
  1019.  
  1020. ;window-structs
  1021.  
  1022. wplt:
  1023.     dc.w    20,15,342,64    ;x,y,w,h
  1024.     dc.b    2,1        ;colors
  1025.     dc.l    $440        ;idcmp,rawkey,upgadget
  1026.     dc.l    $2011006    ;activ,rmbtrap,front/back,drag
  1027.     dc.l    gdgquit,0,wplttitle,0,0
  1028.     dc.w    0,0,0,0
  1029.     dc.w    1
  1030. wplttitle:
  1031.     dc.b "PLTDisplay © '91 J.Schliesser",0
  1032.     even
  1033.  
  1034. screen:
  1035.     dc.w    0,0        ;x,y
  1036.     dc.w    320,256        ;width,height
  1037.     dc.w    0        ;depth
  1038.     dc.b    0,0        ;detail-pen/block-pen
  1039.     dc.w    0        ;viewmodes
  1040.     dc.w    $4f        ;type: custom,superbitmap
  1041.     dc.l    0        ;font
  1042.     dc.l    0        ;title
  1043.     dc.l    0        ;gadgets
  1044.     dc.l    bitmap        ;bitmap
  1045.  
  1046. wscrclose:
  1047.     dc.w    0,0,40,16    ;x,y,w,h
  1048.     dc.b    0,0        ;colors
  1049.     dc.l    $40000        ;idcmp,activewindow
  1050.     dc.l    $10800        ;rmbtrap,borderless
  1051.     dc.l    0,0,0
  1052. clscr:    dc.l    0,0,0,0
  1053.     dc.w    15
  1054.  
  1055. wabout:
  1056.     dc.w    49,5,540,190    ;x,y,w,h
  1057.     dc.b    2,1        ;colors
  1058.     dc.l    $408        ;idcmp,rawkey,mousebuttons
  1059.     dc.l    $2011000    ;activ,rmbtrap,wbenchwindow
  1060.     dc.l    0,0,0,0,0,0,0
  1061.     dc.w    1
  1062.  
  1063. ; gadget structs
  1064.  
  1065. gdgquit:
  1066.     dc.l    gdghelp
  1067.     dc.w    290,15,41,11,0,1,1
  1068.     dc.l    0,0,0,0,0
  1069.     dc.w    1
  1070.     dc.l    0
  1071. gdghelp:
  1072.     dc.l    gdgload1
  1073.     dc.w    233,15,52,11,0,1,1
  1074.     dc.l    0,0,0,0,0
  1075.     dc.w    2
  1076.     dc.l    0
  1077. gdgload1:
  1078.     dc.l    filenamegdg
  1079.     dc.w    186,15,41,11,0,1,1
  1080.     dc.l    0,0,0,0,0
  1081.     dc.w    3
  1082.     dc.l    0
  1083. filenamegdg:
  1084.     dc.l    0
  1085.     dc.w    17,17,160,8,0,2,4
  1086.     dc.l    0,0,0,0,filenamegdginfo
  1087.     dc.w    4
  1088.     dc.l    0
  1089. filenamegdginfo:
  1090.     dc.l    filename,0
  1091.     dc.w    0,80,0,0,0,0,0,0
  1092.     dc.l    0,0,0
  1093. filename:
  1094.     ds.b    82
  1095.  
  1096. ; display rendered fields (field-table => a5, number of fields => d7)
  1097.  
  1098. dofields:
  1099.     move.l    graphbase,a6
  1100. fielding:
  1101.     move.w    (a5)+,d4    ;x-pos
  1102.     move.w    (a5)+,d5    ;y-pos
  1103.     move.w    (a5)+,d6    ;width of field
  1104.     move.w    (a5)+,fieldheight    ;height of field
  1105.     move.l    dorast,a1    ;get rastport
  1106.     moveq    #1,d0
  1107.     jsr    SetAPen(a6)    ;set color for outline
  1108.     move.l    dorast,a1
  1109.     move.w    d4,d0
  1110.     move.w    d5,d1
  1111.     move.w    d4,d2
  1112.     move.w    d5,d3
  1113.     add.w    d6,d2
  1114.     add.w    fieldheight,d3
  1115.     jsr    RectFill(a6)    ;draw outline of field
  1116.     move.l    dorast,a1
  1117.     move.w    (a5)+,d0
  1118.     jsr    SetAPen(a6)    ;set color for field
  1119.     move.l    dorast,a1
  1120.     move.w    d4,d0
  1121.     move.w    d5,d1
  1122.     move.w    d4,d2
  1123.     move.w    d5,d3
  1124.     add.w    #2,d0
  1125.     add.w    #1,d1
  1126.     add.w    d6,d2
  1127.     add.w    fieldheight,d3
  1128.     sub.w    #2,d2
  1129.     sub.w    #1,d3        ;draw field
  1130.     jsr    RectFill(a6)
  1131.     dbra    d7,fielding    ;go on...
  1132.     rts            
  1133.  
  1134. ; print some texts (table of texts => a5, number of texts => d7)
  1135.  
  1136. dotexts:
  1137.     move.l    intuibase,a6
  1138. texting:
  1139.     move.l    dorast,a0    ;get rastport
  1140.     lea    txtext,a1
  1141.     move.w    (a5)+,d0    ;get x-pos
  1142.     move.w    (a5)+,d1    ;get y-pos
  1143.     move.l    (a5)+,txtextpoint    ;pointer to ascii-text
  1144.     jsr    PrintIText(a6)    ;print it ...
  1145.     dbra    d7,texting
  1146.     rts
  1147.  
  1148. ;change window-pointer to sleeping
  1149.  
  1150. pltworkon:
  1151.     move.l    wdwhandle,a0
  1152.     move.l    intuibase,a6
  1153.     lea    sleeppoint,a1
  1154.     moveq    #16,d1
  1155.     moveq    #9,d0
  1156.     moveq    #0,d2
  1157.     moveq    #0,d3
  1158.     jsr    SetPointer(a6)
  1159.     rts
  1160.  
  1161. ;change window-pointer to normal pointer
  1162.  
  1163. pltworkoff:
  1164.     move.l    wdwhandle,a0
  1165.     move.l    intuibase,a6
  1166.     jsr    ClearPointer(a6)
  1167.     rts
  1168.  
  1169.     section    pltdaten,data_c        ;section 2, daten, chipmem
  1170.  
  1171. sleeppoint:
  1172.     dc.l    0
  1173.     dc.l    %00000000000000000001000100010000
  1174.     dc.l    %00010001000100000010101010101000
  1175.     dc.l    %00100010001000000101010101010000
  1176.     dc.l    %01000100010000001010101010100000
  1177.     dc.l    %11101110111000000001000100010000
  1178.     dc.l    %01000100010000001011101110100000
  1179.     dc.l    %01000100010000001010101010110101
  1180.     dc.l    %01000100010101011010101010101010
  1181.     dc.l    %00000000000000000100010001010101
  1182.     dc.l    0
  1183.  
  1184.  END
  1185.  
  1186.